﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Codemonk.Common.Injection;
using Codemonk.Common.Configuring;
using Codemonk.Common.Diagnostic;
using System.Net;
using Codemonk.Common.Data;

namespace Codemonk.CloudBox.UnitTests.Injection
{
    [TestClass]
    public class InjectionTest
    {
        [TestMethod]
        public void DefaultObjectBuilderTest()
        {
            //Console.WriteLine(ActionTimer.Time(() => { DefaultObjectBuilder.Instance.ResolveObjectBuilder("default"); }));
            //Console.WriteLine(ActionTimer.Time(() => { DefaultObjectBuilder.Instance.ResolveObjectBuilder("default0"); }, 50));
            //var builder = DefaultObjectBuilder.Instance.ResolveObjectBuilder("default");
            //var obj = builder.Resolve("default_server");
            //var default_server_port = builder.Resolve("default_server_port");
            //var default_log = builder.Resolve("default_log");
            //default_log = builder.Resolve("default_log");
            //Console.WriteLine(object.ReferenceEquals(builder.Resolve("default_log"), builder.Resolve("default_log")));
            Console.WriteLine(ActionTimer.Time(() => { DefaultObjectBuilder.ResolveObjectBuilder("default").Resolve("default_log"); }));
            //Console.WriteLine(ActionTimer.Time(() => { DefaultObjectBuilder.Instance.ResolveObjectBuilder("default").Resolve<Codemonk.Common.Logging.ILog>(); }));
            //Console.WriteLine(ActionTimer.Time(() => { builder.Resolve("default_log"); }, 50));
            var factory = DefaultObjectBuilder.ResolveObjectBuilder().Resolve<IDbAccessorFactory>();
            var dbaccessor = factory.Get("mssql");
        }
    }
}
